/*js浏览器ie兼容性重写*/
if (typeof String.prototype.startsWith != 'function') {
    String.prototype.startsWith = function (prefix){
        return this.slice(0, prefix.length) === prefix;
    };
}
if (typeof String.prototype.endsWith != 'function') {
    String.prototype.endsWith = function (suffix){
        return this.slice(-1*suffix.length) === suffix;
    };
}
if (typeof String.prototype.trimRight != 'function') {
    String.prototype.trimRight = function (){
        return this.replace(/\s+$/g, '');;
    };
}
if (typeof String.prototype.trimLeft != 'function') {
    String.prototype.trimLeft = function (){
        return this.replace(/^\s+/g, '');
    };
}
if (typeof String.prototype.trim != 'function') {
    String.prototype.trim = function (){
        return this.replace(/^\s+|\s+$/g, '');
    };
}
/*拷贝属性*/
if (typeof Object.assign != 'function') {
    Object.assign = function(target) {
        'use strict';
        if (target == null) {
            throw new TypeError('Cannot convert undefined or null to object');
        }

        target = Object(target);
        for (var index = 1; index < arguments.length; index++) {
            var source = arguments[index];
            if (source != null) {
                for (var key in source) {
                    if (Object.prototype.hasOwnProperty.call(source, key)) {
                        target[key] = source[key];
                    }
                }
            }
        }
        return target;
    };
}
/*超级好用的合并对象 true,target,source */
if(typeof Object.extend != 'function'){
    /*不兼容ie
    var isPlainObject = function( obj ) {
        var proto, Ctor;

        // Detect obvious negatives
        // Use toString instead of jQuery.type to catch host objects
        if ( !obj || toString.call( obj ) !== "[object Object]" ) {
            return false;
        }

        proto = Object.getPrototypeOf( obj );

        // Objects with no prototype (e.g., `Object.create( null )`) are plain
        if ( !proto ) {
            return true;
        }

        // Objects with prototype are plain iff they were constructed by a global Object function
        Ctor = {}.hasOwnProperty.call( proto, "constructor" ) && proto.constructor;
        return typeof Ctor === "function" && Object.getPrototypeOf.toString.call( Ctor ) === Object.getPrototypeOf.toString.call( Object );
    }*/
    function isPlainObject(obj){
        var prototype;

        return Object.prototype.toString.call(obj) === '[object Object]'
            && (prototype = Object.getPrototypeOf(obj), prototype === null ||
            prototype == Object.getPrototypeOf({}))
    }
    var extend =
        function() {
            var options, name, src, copy, copyIsArray, clone,
                target = arguments[ 0 ] || {},
                i = 1,
                length = arguments.length,
                deep = false;

            // Handle a deep copy situation
            if ( typeof target === "boolean" ) {
                deep = target;

                // Skip the boolean and the target
                target = arguments[ i ] || {};
                i++;
            }

            // Handle case when target is a string or something (possible in deep copy)
            if ( typeof target !== "object" && typeof target !== "function" ) {
                target = {};
            }

            // Extend jQuery itself if only one argument is passed
            if ( i === length ) {
                target = this;
                i--;
            }

            for ( ; i < length; i++ ) {

                // Only deal with non-null/undefined values
                if ( ( options = arguments[ i ] ) != null ) {

                    // Extend the base object
                    for ( name in options ) {
                        copy = options[ name ];

                        // Prevent Object.prototype pollution
                        // Prevent never-ending loop
                        if ( name === "__proto__" || target === copy ) {
                            continue;
                        }

                        // Recurse if we're merging plain objects or arrays
                        if ( deep && copy && ( isPlainObject( copy ) ||
                            ( copyIsArray = Array.isArray( copy ) ) ) ) {
                            src = target[ name ];

                            // Ensure proper type for the source value
                            if ( copyIsArray && !Array.isArray( src ) ) {
                                clone = [];
                            } else if ( !copyIsArray && !isPlainObject( src ) ) {
                                clone = {};
                            } else {
                                clone = src;
                            }
                            copyIsArray = false;

                            // Never move original objects, clone them
                            target[ name ] = extend( deep, clone, copy );

                            // Don't bring in undefined values
                        } else if ( copy !== undefined ) {
                            target[ name ] = copy;
                        }
                    }
                }
            }

            // Return the modified object
            return target;
        };
    Object.extend = extend;
}
// 兼容ie数组没有findIndex方法
if (!Array.prototype.findIndex) {
    Object.defineProperty(Array.prototype, 'findIndex', {
    value: function(predicate) {
     if (this == null) {
        throw new TypeError('"this" is null or not defined');
     }
     var o = Object(this);
     var len = o.length >>> 0;
     if (typeof predicate !== 'function') {
        throw new TypeError('predicate must be a function');
     }
     var thisArg = arguments[1];
     var k = 0;
     while (k < len) {
     var kValue = o[k];
     if (predicate.call(thisArg, kValue, k, o)) {
        return k;
     }
     k++;
     }
     return -1;
    }
    });
}
//解决IE8之类不支持getElementsByClassName
if  (!document.getElementsByClassName) {
     document.getElementsByClassName =  function  (className, element) {
         var  children = (element || document).getElementsByTagName( '*' );
         var  elements =  new  Array();
         for  ( var  i = 0; i < children.length; i++) {
             var  child = children[i];
             var  classNames = child.className.split( ' ' );
             for  ( var  j = 0; j < classNames.length; j++) {
                 if  (classNames[j] == className) {
                     elements.push(child);
                     break ;
                 }
             }
         }
         return  elements;
     };
}
window.console = window.console || (function(){
    var c = {}; c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile
    = c.clear = c.exception = c.trace = c.assert = function(){};
    return c;
})();

__encode="jsjiami.com"
